package com.nulldev.util.web.nTubeExtensions.extended.objects;

import com.nulldev.util.web.nTubeExtensions.extended.objects.codecs.EAudioCodec;
import com.nulldev.util.web.nTubeExtensions.extended.objects.codecs.EVideoCodec;

public class ExtendedVideoFormat {

	private final String url;
	private final int width, height;
	private final int audioChannels, audioBitrate;

	private final EAudioCodec audioCodec;
	private final EVideoCodec videoCodec;

	public ExtendedVideoFormat(final String url) {
		this.url = url;
		this.width = -1;
		this.height = -1;
		this.audioBitrate = -1;
		this.audioChannels = 0;
		this.audioCodec = EAudioCodec.NONE;
		this.videoCodec = EVideoCodec.NONE;
	}

	public ExtendedVideoFormat(final String url, final EAudioCodec aCodec, final EVideoCodec vCodec) {
		this.url = url;
		this.width = -1;
		this.height = -1;
		this.audioBitrate = -1;
		this.audioChannels = 0;
		this.audioCodec = aCodec;
		this.videoCodec = vCodec;
	}

	public ExtendedVideoFormat(final String url, final EVideoCodec codec, final int width, final int height) {
		this.url = url;
		this.width = width;
		this.height = height;
		this.audioBitrate = -1;
		this.audioChannels = 0;
		this.audioCodec = EAudioCodec.NONE;
		this.videoCodec = codec;
	}

	public ExtendedVideoFormat(final String url, final EAudioCodec codec, final int audioChannels, final int audioBitrate) {
		this.url = url;
		this.audioBitrate = audioBitrate;
		this.audioChannels = audioChannels;
		this.width = -1;
		this.height = -1;
		this.audioCodec = codec;
		this.videoCodec = EVideoCodec.NONE;
	}

	public String url() {
		return this.url;
	}

	public boolean hasVideo() {
		return !this.videoCodec.equals(EVideoCodec.NONE);
	}

	public int getWidth() {
		return this.width;
	}

	public int getHeight() {
		return this.height;
	}

	public boolean hasAudio() {
		return !this.audioCodec.equals(EAudioCodec.NONE);
	}

	public int getAudioChannels() {
		return this.audioChannels;
	}

	public int getAudioBitrate() {
		return this.audioBitrate;
	}
}
